//package com.yutian.web.service.impl;
//
//import com.yutian.common.core.domain.AjaxResult;
//import com.yutian.web.mapper.ServiceTypeMapper;
//import com.yutian.web.service.ServiceTypeService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.yutian.web.domain.ServiceType;
//
//import java.util.Date;
//import java.util.List;
//
//@Service
//public class ServiceTypeServiceImpl implements ServiceTypeService {
//    @Autowired
//    private ServiceTypeMapper serviceTypeMapper;
//
//    @Override
//    public List<ServiceType> selectList(ServiceType serviceType) {
//        return serviceTypeMapper.selectList(serviceType);
//    }
//
//    @Override
//    public Object selectById(Long id) {
//        return serviceTypeMapper.selectByPrimaryKey(id);
//    }
//
//    @Override
//    public synchronized AjaxResult edit(ServiceType serviceType) {
//        serviceTypeMapper.updateByPrimaryKeySelective(serviceType);
//        return AjaxResult.success();
//    }
//
//    @Override
//    public synchronized AjaxResult add(ServiceType serviceType) {
//        serviceType.setCreateTime(new Date());
//        serviceTypeMapper.insert(serviceType);
//        return AjaxResult.success();
//    }
//
//    private AjaxResult checkUnique(ServiceType serviceType) {
//        ServiceType codeCheck = new ServiceType();
//        codeCheck.setTypeCode(serviceType.getTypeCode());
//        if(serviceTypeMapper.selectCount(codeCheck)>0){
//            return AjaxResult.error("编码重复");
//        }
//        ServiceType nameCheck = new ServiceType();
//        nameCheck.setTypeName(serviceType.getTypeName());
//        if(serviceTypeMapper.selectCount(codeCheck)>0){
//            return AjaxResult.error("名称重复");
//        }
//        return AjaxResult.success();
//    }
//
//    @Override
//    public int deleteId(Long id) {
//        return serviceTypeMapper.deleteByPrimaryKey(id);
//    }
//}
